home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / tree / DefaultMutableTreeNode$PathBetweenNodesEnumeration.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.6 KB  |  46 lines

  1. package javax.swing.tree;
  2.  
  3. import java.util.EmptyStackException;
  4. import java.util.Enumeration;
  5. import java.util.NoSuchElementException;
  6. import java.util.Stack;
  7.  
  8. final class DefaultMutableTreeNode$PathBetweenNodesEnumeration implements Enumeration {
  9.    // $FF: synthetic field
  10.    private final DefaultMutableTreeNode this$0;
  11.    protected Stack stack;
  12.  
  13.    public DefaultMutableTreeNode$PathBetweenNodesEnumeration(DefaultMutableTreeNode var1, TreeNode var2, TreeNode var3) {
  14.       this.this$0 = var1;
  15.       if (var2 != null && var3 != null) {
  16.          this.stack = new Stack();
  17.          this.stack.push(var3);
  18.          TreeNode var4 = var3;
  19.  
  20.          while(var4 != var2) {
  21.             var4 = var4.getParent();
  22.             if (var4 == null && var3 != var2) {
  23.                throw new IllegalArgumentException("node " + var2 + " is not an ancestor of " + var3);
  24.             }
  25.  
  26.             this.stack.push(var4);
  27.          }
  28.  
  29.       } else {
  30.          throw new IllegalArgumentException("argument is null");
  31.       }
  32.    }
  33.  
  34.    public boolean hasMoreElements() {
  35.       return this.stack.size() > 0;
  36.    }
  37.  
  38.    public Object nextElement() {
  39.       try {
  40.          return this.stack.pop();
  41.       } catch (EmptyStackException var1) {
  42.          throw new NoSuchElementException("No more elements");
  43.       }
  44.    }
  45. }
  46.